<script setup lang="ts">
import { ProjectModel } from '@/api/webSite/response';
import GoToButton from '../Buttons/GoToButton.vue';

const { project } = defineProps<{
  project: ProjectModel
}>();
console.log(project)

function goToCode() {
  if (project.link) {
    window.open(project.link, "_blank");
  }
}

</script>

<template>
  <div class="cookie-card">
    <span class="title">🍪 {{ project.name }}</span>
    <div>
      <p class="description">
        {{ project.desc }}
      </p>
    </div>
    <div class="actions">
      <button class="pref">
        可能并不完善
      </button>
      <GoToButton @click="goToCode">Get Code</GoToButton>
    </div>
  </div>
</template>

<style scoped lang="scss">
.cookie-card {
  max-width: 320px;
  width: 400px;
  padding: 1rem;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 20px 20px 30px rgba(0, 0, 0, .05);

  .title {
    font-weight: 600;
    color: rgb(31 41 55);
  }

  div {

    height: 50px;

    .description {
      margin-top: 1rem;
      font-size: 0.875rem;
      line-height: 1.25rem;
      color: rgb(75 85 99);

      a {
        --tw-text-opacity: 1;
        color: rgb(59 130 246);

        &:hover {
          -webkit-text-decoration-line: underline;
          text-decoration-line: underline;
        }
      }
    }
  }

  .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    -moz-column-gap: 1rem;
    column-gap: 1rem;
    flex-shrink: 0;
  }

  .pref {
    font-size: 0.75rem;
    line-height: 1rem;
    color: red;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background-color: transparent;

    &:hover {
      color: rgb(156 163 175);
    }

    &:focus {
      outline: 2px solid transparent;
      outline-offset: 2px;
    }
  }

  .accept {
    font-size: 0.75rem;
    line-height: 1rem;
    background-color: rgb(17 24 39);
    font-weight: 500;
    border-radius: 0.5rem;
    color: #fff;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    border: none;
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);

    &:hover {
      background-color: rgb(55 65 81);
    }

    &:focus {
      outline: 2px solid transparent;
      outline-offset: 2px;
    }
  }
}
</style>
